//
//  GetDatasource.swift
//  CompareBuying
//
//  Created by 唐先才 on 16/2/22.
//  Copyright © 2016年 唐先才. All rights reserved.
//

import UIKit

class GetDatasource: NSObject {

    static func getDataWithUrlAndParameters(Url: String, parameters: NSDictionary, collectionView: UICollectionView) -> ([AnyObject]) {
        let manager: AFHTTPRequestOperationManager = AFHTTPRequestOperationManager()
        var array = [AnyObject]()
        manager.POST(Url, parameters: parameters, success: { (operation: AFHTTPRequestOperation!, responseObject: AnyObject!) -> Void in
            guard let array3 = responseObject as? [[String: AnyObject]] else {
                print("请求数据有问题")
                return
            }
            for dict3 in array3 {
                let model = TxcModel.modelWithDict(dict3)
                array.append(model)
            }
            collectionView.reloadData()
            }) { (operation: AFHTTPRequestOperation!, error: NSError!) -> Void in
                
        }
        return array
    }
}
